package org.geektime.task.sboauth.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.Map;

/**
 * <p> HomeController.java.</p>
 * <p>Description:  .</p>
 * <p>Company: .</p>
 * <p>@author Long Yu</p>
 * <p>@version .</p>
 * 2021年04月21日 21:31:50
 */
@Controller
public class HomeController {


    @RequestMapping("/")
    public String index(){
        return "forward:/index.html";
    }


    @RequestMapping("/getUserSession")
    @ResponseBody
    public Map<String,Object> getUserSession(HttpServletRequest request){

        Object user = request.getSession().getAttribute("user");
        Map<String,Object> rMap = new HashMap<String, Object>();

        rMap.put("user",user);
        return rMap;
    }







}
